#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int n;
class Node{
public:
	LL t;
	vector<int> vec;		
};
queue<Node> que;
int psum[100005];
int ki;
LL ti;
int x;

int main(){
	cin>>n;
	memset(psum,0,sizeof(psum));
	int ans=0;
	for(int i=0;i<n;i++){
		cin>>ti>>ki;
		Node node;
		node.t=ti;
		while(!que.empty()&&que.front().t+86400L<=ti){
			Node temp=que.front();
			que.pop();
			for(auto& k:temp.vec){
				psum[k]--;
				if(psum[k]==0) ans--;
			}
		}
		for(int j=0;j<ki;j++){
			cin>>x;
			if(psum[x]==0) ans++;
			psum[x]++;
			node.vec.push_back(x);
		}
		que.push(node);
		cout<<ans<<endl;
	}
	return 0;
}
